home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1995-03-28 | 2.4 KB | 101 lines |
- > RPIindex
- Copyright E.F.Lord 23/9/90
- Modified by David Holden to take RPI from external list March '95
- (-3) debug%=
- debug%=
- error
- debug%
- debug
- question
- answer
- @%=&0002020A
- rpi(100)
- inf=5
- "XOS_File",17,"<RPIindex$Dir>.index"
- O%,,,,len%
- O%<>1
- 0,"Can't find Index file, unable to continue":
- buff% len%+16
- "OS_File",16,"<RPIindex$Dir>.index",buff%,0
- "buff%!len%=&0D0D0D0D:I%=buff%:
- I%<buff%+len%
- ?I%=10
- ?I%=13
- I%+=1
- I%=buff%:J%=0
- min_year%=
- ($I%)
- ?I%<>13:I%+=1:
- :I%+=1
- rpi(J%)=
- ($I%):J%+=1
- ?I%<>13:I%+=1:
- :I%+=1
- I%>=buff%+len%
- max_year%=min_year%-1+J%
- debug
- I%=min_year%
- max_year%
- @%=10:
- +% @%=&0002020A:
- rpi(I%-min_year%)
- '"Press SPACE to continue":
- K%=32
- error
- " @ line ";
- ;" - Press SPACE to continue"
- K%=32
- question
- title
- 0,y)"Enter 1st year for comparison "year%
- dateok
- date1$=
- (year%)
- 0,y+2)"Enter cost of item in ";date1$;
- "price1
- 0,y)"Enter 2nd year for comparison "year%
- dateok
- date2$=
- (year%)
- dateok
- year%<100 year%+=1900
- (year%<min_year%)
- (year%>max_year%):
- 40," "):=
- answer
- title
- (date1$):yr2=
- (date2$)
- N3rpi1=rpi(yr1-min_year%):rpi2=rpi(yr2-min_year%)
- price2=price1*rpi2/rpi1
- elaps=
- (yr2-yr1)
- elaps=0
- elaps=1
- avrpi=
- (rpi2-rpi1)/elaps
- yr1<yr2
- k=(rpi2/rpi1)
- k=(rpi1/rpi2)
- i=(10^(
- (k)/elaps)-1)*100
- 0,6)"Average Retail Price Index for ";date1$;" is ",rpi1
- 0,7)"Average Retail Price Index for ";date2$;" is ",rpi2
- 0,9) "RPI index multiplier is ",k
- 0,10)"Inverse RPI index multiplier is ",1/k
- 0,12)"Average change in RPI per annum is ",avrpi;" pts"
- 0,13)"Average rate of inflation ",i;" %"
- 0,15)"In ";date1$;" the sum given was
- ",price1
- 0,17)"giving an equivalent value in ";date2$;" of
- ",price2
- 0,22)"Press RETURN to continue";
- title
- c @%=10
- 10,820,1260,160
- 23,17,7,6,8;16;0;
- 420,920
- "UK RETAIL PRICES ";min_year%;" - ";max_year%
- PRINTTAB(13,3)"(Rebased 1987)"
- @%=&0002020A
-